# General variables, needed because of the configure script

prefix		= @prefix@
exec_prefix	= @exec_prefix@

# Some variables to easily adapt the version number of the library

LIBRARYNAME = libjrtp
LIBRARYMAJORVERSION = 2
LIBRARYMINORVERSION = 5
LIBRARYFULLVERSION = $(LIBRARYMAJORVERSION).$(LIBRARYMINORVERSION)
LIBRARYFULLNAME = $(LIBRARYNAME).so-$(LIBRARYFULLVERSION)
LIBRARYINTERNALNAME = $(LIBRARYNAME).so.$(LIBRARYFULLVERSION)
ARCHIVE = $(LIBRARYNAME).a

LDFLAGS = @RTP_LDFLAGS@
ARFLAGS = @RTP_ARFLAGS@

# Where to install the libraries. This is determined by the configure
# script

LIBRARYINSTALLDIR = @libdir@

# Flags and objects

CC 	= @CXX@
FLAGS 	= @RTP_CFLAGS@
OBJECTS = rtpconnection.o rtpcontributingsources.o rtpdestlist.o \
          rtperror.o rtpiptable.o rtppacket.o rtppacketprocessor.o \
          rtprandom.o rtprtcpmodule.o rtpsession.o rtpsourcedata.o \
          rtpsourcedescription.o rtpsources.o rtpsrclist.o rtptimeutil.o \
          rtplocalinfo.o rtphandlers.o rtpdebug.o rtpmcasttable.o

# Rules to make the compilation possible

.SUFFIXES: .cpp

.cpp.o:
	$(CC) $(FLAGS) -c -o $@ $<

all: @RTP_TARGETS@

clean:
	rm -f $(OBJECTS) $(LIBRARYFULLNAME) $(ARCHIVE)

distclean: clean
	rm -f config.log config.cache config.status Makefile rtpconfig_unix.h
	
dummymsg:
	@echo "Nothing to build"
	
sharedlib: $(LIBRARYFULLNAME)
	
staticlib: $(ARCHIVE)

$(LIBRARYFULLNAME): $(OBJECTS)
	rm -f $(LIBRARYFULLNAME)
	ld $(LDFLAGS) $(LIBRARYINTERNALNAME) -o $(LIBRARYFULLNAME) $(OBJECTS)

$(ARCHIVE): $(OBJECTS)
	rm -f $(ARCHIVE)
	ar $(ARFLAGS) $(ARCHIVE) $(OBJECTS)

rtpconnection.o: rtpconnection.cpp
rtpcontributingsources.o: rtpcontributingsources.cpp
rtpdestlist.o: rtpdestlist.cpp
rtperror.o: rtperror.cpp
rtpiptable.o: rtpiptable.cpp
rtppacket.o: rtppacket.cpp
rtppacketprocessor.o: rtppacketprocessor.cpp
rtprandom.o: rtprandom.cpp
rtprtcpmodule.o: rtprtcpmodule.cpp
rtpsession.o: rtpsession.cpp
rtpsourcedata.o: rtpsourcedata.cpp
rtpsourcedescription.o: rtpsourcedescription.cpp
rtpsources.o: rtpsources.cpp
rtpsrclist.o: rtpsrclist.cpp
rtptimeutil.o: rtptimeutil.cpp
rtplocalinfo.o: rtplocalinfo.cpp
rtphandlers.o: rtphandlers.cpp
rtpdebug.o: rtpdebug.cpp
rtpmcasttable.o: rtpmcasttable.cpp
